package org.batyrov.equery.action;

import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.util.ServletContextAware;
import org.batyrov.equery.dao.Dao;
import com.opensymphony.xwork2.ActionSupport;

import javax.servlet.ServletContext;
import javax.persistence.EntityManager;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: admin
 * Date: 24.07.2009
 * Time: 23:56:05
 * To change this template use File | Settings | File Templates.
 */
public class BaseAction extends ActionSupport implements ServletContextAware, SessionAware {
    protected Dao dao;
    protected EntityManager em;
    protected Map session;
    protected ServletContext servletContext;

    @Override
    public void setServletContext(ServletContext servletContext) {
        this.servletContext = servletContext;
    }

    @Override
    public void setSession(Map map) {
        this.session = map;
    }

    @Override
    public String execute() throws Exception {
        dao = new Dao();
        em = dao.getEm();        
        return super.execute();
    }
}
